#pragma once

#include <unordered_map>
#include "../share/user_define.h"
#include "../../3rd/libjson/json.h"

/*
"id": 4,
"exp": 60,
"skill_limit": 1,
"skill_ceiling": 20,
"grade": 1
*/

struct HeroLevelUp
{
	uint32_t mId;
	uint32_t mExp;
	uint32_t mSkillLimit;
	uint32_t mSkillCeiling;
	uint32_t mGrade;

	HeroLevelUp()
	{
		Clear();
	}

	void Clear(void)
	{
		mId = 0;
		mExp = 0;
		mSkillLimit = 0;
		mSkillCeiling = 0;
		mGrade = 0;
	}
};

class HeroLevelUpCacheData
{
public:

	static void CreateInstance(void);
	static HeroLevelUpCacheData* GetInstance(void);

	~HeroLevelUpCacheData(void);

public:

	bool Initialization(void);

	bool Reload(void);

	HeroLevelUp* GetData(uint32_t id);

	bool GetDataJsonString(uint32_t id, Json::Value& _jm);

	uint32_t GetDataCount(void);

private:
	HeroLevelUpCacheData(void);

	void Clear(void);

	void AddData(uint32_t id, Json::Value& jm);


private:

	static HeroLevelUpCacheData* mInstance;

	std::unordered_map<uint32_t, HeroLevelUp*> m_mapCacheData;
	uint32_t m_maxCount;

};

